﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Kotonoha.Server.Dictionaries.Kanjidic2 {
    public class Kanjidic2 : ICharDictionary {
        readonly internal Dictionary<string, CharEntry> dic = new Dictionary<string, CharEntry>(2048);

        public string Version { get; set; }

        public string DatabaseCreation { get; set; }

        public string CreationDate { get; set; }

        public CharEntry find(string c) {
            CharEntry val;
            return dic.TryGetValue(c, out val) ? val : null;
        }

        public void Add(string writing, CharEntry entry) {
            dic.Add(writing, entry);
        }

        public IEnumerator<CharEntry> GetEnumerator() {
            return dic.Values.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }

        public long Count {
            get { return dic.Count; }
        }
    }
}
